package com.example.barcodeapp.ui.wode.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseActivity;
import com.example.barcodeapp.interfaces.IBasePersenter;
import com.example.barcodeapp.interfaces.own.IOwn;
import com.example.barcodeapp.persenter.OnePresenterWoDeHuoDong;
import com.example.barcodeapp.ui.huodong.Bean.HuoDongXiangQingBean;
import com.example.barcodeapp.ui.huodong.activity.ErWeiMaActivity;
import com.example.barcodeapp.ui.huodong.activity.HuoDongXiangQingActivity;
import com.example.barcodeapp.ui.wode.adapter.WoDeHuoDongAdapter;
import com.example.barcodeapp.ui.wode.bean.WoDHuoDong;
import com.example.barcodeapp.utils.Show;

import java.io.Serializable;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class HotActivity extends BaseActivity<IOwn.Persenterwodehuodong> implements IOwn.Viewwodehuodong {
    @BindView(R.id.iv_back_circle)
    ImageView ivBackCircle;
    @BindView(R.id.ff_back_contener)
    FrameLayout ffBackContener;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_location)
    TextView tvLocation;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ll_to_search)
    LinearLayout llToSearch;
    @BindView(R.id.right_iv)
    ImageView rightIv;
    @BindView(R.id.right_iv_two)
    ImageView rightIvTwo;
    @BindView(R.id.tv_rught_)
    TextView tvRught;
    @BindView(R.id.tv_right_two)
    TextView tvRightTwo;
    @BindView(R.id.toolBar)
    Toolbar toolBar;
    @BindView(R.id.linearLayout9)
    LinearLayout linearLayout9;
    @BindView(R.id.rvwodehuodong)
    RecyclerView rvwodehuodong;
    private List<WoDHuoDong.DataEntity> list;
    @Override
    protected int getLayout() {
        return R.layout.hot_huodong_activity;
    }

    @Override
    protected void initView() {
        setToolBar(true, false, true, false, false);
        setTitle("我的活动", R.color.black, R.color.white);
    }

    @Override
    protected OnePresenterWoDeHuoDong initPersenter() {
        return new OnePresenterWoDeHuoDong();
    }

    @Override
    protected void initData() {
            persenter.getwodehuodong(1);
    }

    @Override
    public void getwodehuodong(WoDHuoDong xiLieKeBean) {
        list= (List<WoDHuoDong.DataEntity>) xiLieKeBean.getData();
        rvwodehuodong.setLayoutManager(new LinearLayoutManager(this));
        WoDeHuoDongAdapter woDeHuoDongAdapter = new WoDeHuoDongAdapter(this,xiLieKeBean.getData());
        rvwodehuodong.setAdapter(woDeHuoDongAdapter);
        woDeHuoDongAdapter.notifyDataSetChanged();
        woDeHuoDongAdapter.setCallback(new WoDeHuoDongAdapter.IClick() {
            @Override
            public void click(int pos) {
                Intent intent = new Intent(HotActivity.this, ErWeiMaActivity.class);
                intent.putExtra("data","我的");
                intent.putExtra("id",xiLieKeBean.getData().get(pos).getId()+"");
                Bundle bundle = new Bundle();
                bundle.putSerializable("tbItemBeanList", (Serializable) list);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

    }
}
